pub mod helper;
pub mod routes;

use axum::Router;
use tokio::net::TcpListener;
use tower_http::cors::{Any, CorsLayer};

pub async fn run() {
    let app = Router::new()
        .nest("/api/v1", routes::gen_routes())
        .layer(
            CorsLayer::new()
                .allow_origin(Any)
                .allow_methods(Any)
                .allow_headers(Any),
        );
    let listener = TcpListener::bind("127.0.0.1:30002").await.unwrap();
    axum::serve(listener, app).await.unwrap();
}
